package com.situ.javase.day12;

public class MoneyManager {

	// 余额（当前账户的金额）
	private Double balance;
	// 用户的账户
	private String number;
	
	public MoneyManager(Double balance, String number) {
		this.balance = balance;
		this.number = number;
	}
	
	// 存钱deposite
	public void deposite(double money) {
		balance += money;
	}
	
	// 取钱withdraw
	public void withdraw(double money) throws MyException{
		if (balance >= money) {
			balance -= money;
		} else {
			//余额不足
			double need = money - balance;
			throw new MyException(need);
		}
	}
}
